package com.scott.ch01.student.client;

import com.scott.ch01.spring.SpringConfiguration;
import com.scott.ch01.student.bean.StudentBean;
import com.scott.ch01.student.service.StudentService;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.UUID;

/**
 * @author 黄后林
 * @version 1.0
 * @note
 * @date 2021-11-23 22:22:24
 */
public class StudentServiceTest {


    @Test
    public void addTest(){
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext(SpringConfiguration.class);

        StudentService service = context.getBean(StudentService.class);

        StudentBean student = new StudentBean();
        String name = UUID.randomUUID().toString().substring(0, 8);
        student.setName(name);
        student.setAge(117);
        service.addStudent(student);
    }
}
